package demo1;

import com.sun.source.util.Trees;

import java.util.*;

/**
 * @Author liangzai
 * @Description:
 */
public class Test {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            fun3();
            System.out.println();
        }
    }

    public static void fun3() {
        Random random = new Random();
        char[] ch = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
        'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M','1',
                '2','3','4','5','6','7','8','9'};
        for (int i = 0; i < 4; i++) {
            int a = random.nextInt(60);
            System.out.print(ch[a]);
        }
    }

    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] array = new int[6];
        for (int i = 0; i < array.length; i++) {
            array[i] = scanner.nextInt();
        }
        int max = 0;
        int min = 101;
        int sum = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i]>=max){
                max = array[i];
            }
            if(array[i]<=min){
                min = array[i];
            }
            sum += array[i];
        }
        sum = sum - max - min;
        System.out.println("平均分："+(float)sum/4);
    }

    public static void main4(String[] args) {
        int[] array = {11,22,33,44,55};
        int l = 0;
        int r = array.length-1;
        while (l < r) {
            int tmp = array[l];
            array[l++] = array[r];
            array[r--] = tmp;
        }
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
    }

    public static void fun1(int[] array1,int[] array2){
        for (int i = 0; i < array1.length; i++) {
            if(array1[i] != array2[i]){
                System.out.println("不一样！");
                return ;
            }
        }
        System.out.println("一样！");
    }

    public static void main3(String[] args) {
        int[] array1 = {1,3,5,7,9};
        int[] array2 = {2,4,6,8,10};
        int[] array3 = {1,3,5,7,9};
        fun1(array1,array2);
        fun1(array1,array3);
    }

    public static boolean fun(int x){
        while (x > 0) {
            if (x % 10 == 7 || x % 7 == 0) {
                return true;
            }
            x /= 10;
        }
        return false;
    }

    public static void main2(String[] args) {
        for (int i = 1; i <= 100 ; i++) {
            if (fun(i) == true) {
                System.out.print("过"+" ");
            }else {
                System.out.print(i+" ");
            }
            if (i % 10 == 0) {
                System.out.println();
            }
        }
    }

    public static void main1(String[] args) {
        HashSet<String> set = new HashSet<>();
        set.add("liuzhi");
        set.add("abc");
        set.add("zhagn");
        Iterator<String> it = set.iterator();
        while (it.hasNext()) {
            System.out.print(it.next()+" ");
        }
    }
}
